<!--
 * @Author: lhl 1079161148@qq.com
 * @Date: 2023-07-22 11:02:17
 * @LastEditors: lhl 1079161148@qq.com
 * @LastEditTime: 2023-07-23 21:34:57
 * @FilePath: \door-pc\src\views\index.vue
 * @Description: 首页
-->
<template>
  <div class="index-wrap">
    <!-- 头部 -->
    <div class="header-wrap">
      <div class="logo">
        <img :src="logoImg" alt="seo" />
      </div>
      <div class="search-box">
        <el-input placeholder="请输入内容" v-model="searchVal">
          <template slot="append"
            ><el-button type="success">搜索</el-button></template
          >
        </el-input>
      </div>
    </div>
    <!-- 内容 -->
    <div class="page-wrap">
      <div class="left-wrap"></div>
      <div class="content">
        <!-- 轮播 -->
        <el-carousel height="250px" type="card" :interval="5000" arrow="always">
          <el-carousel-item v-for="item in bannerList" :key="item.id">
            <img :src="item.url" alt="seo" />
          </el-carousel-item>
        </el-carousel>
        <!-- 商品区域 -->
        <div class="goods-list">
          <!-- 分类 -->
          <div class="goods-sort-box">
            <div class="goods-nav">
              <h1 class="goods-title">安踏</h1>
              <div class="nav-list">
                <div class="nav-item" v-for="item in navList" :key="item.id">
                  {{ item.text }}
                </div>
              </div>
            </div>
            <div class="goods-more">
              <el-button type="text"
                >更多<i class="el-icon-right"></i
              ></el-button>
            </div>
          </div>
          <!-- 商品区域 -->
          <div class="goods-item">
            <div class="goods-left">
              <div class="goods-top-img">
                <img :src="topImg" alt="seo" />
              </div>
              <div class="goods-bottom-img">
                <img :src="bottomImg" alt="seo" />
              </div>
            </div>
            <!-- 商品准确分类 -->
            <div class="goods-right">
              <div class="sort-goods-item" v-for="item in 10" :key="item">
                <div class="sort-goods-img">
                  <img :src="goodsImg" alt="seo" />
                </div>
                <div class="sort-goods-title">
                  安踏国家队赞助圆领短袖T恤452220102
                </div>
                <div class="sort-goods-price">￥299.00</div>
              </div>
            </div>
          </div>
        </div>
      </div>
      <div class="right-wrap"></div>
    </div>
    <!-- 页尾 -->
    <div class="footer-wrap">
      <div class="tip">
        Copyright © 2016-2025 领胜团购商城 版权所有 保留一切权利
        备案号:豫ICP备2021021410号-2
      </div>
    </div>
  </div>
</template>

<script>
export default {
  name: 'Index',
  data() {
    return {
      searchVal: '',
      logoImg: require('@/assets/logo.png'),
      topImg: require('@/assets/top-img.png'),
      bottomImg: require('@/assets/bottom-img.png'),
      goodsImg: require('@/assets/goods-img.png'),
      bannerList: [
        {
          id: 1,
          url: require('@/assets/banner1.png')
        },
        {
          id: 2,
          url: require('@/assets/banner2.png')
        },
        {
          id: 3,
          url: require('@/assets/banner3.png')
        }
      ],
      navList: [
        {
          id: 1,
          text: '服装'
        },
        {
          id: 2,
          text: '鞋子'
        }
      ]
    };
  }
};
</script>

<style lang="scss" scoped>
.index-wrap {
  display: flex;
  flex-direction: column;
  background: #f0f4f8;
  .header-wrap {
    width: 100%;
    height: 80px;
    background: #fff;
    display: flex;
    justify-content: space-around;
    align-items: center;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.12);
    .logo {
      width: 160px;
      height: 58px;
      img {
        width: 100%;
        height: auto;
      }
    }
    .search-box {
      // display: flex;
      .el-input {
        width: 480px;
      }
      .el-input-group__append button.el-button {
        background-color: #2c8ff4;
        color: #fff;
      }
    }
  }
  .page-wrap {
    display: flex;
    // overflow-y: auto;
    .content {
      padding: 20px;
      margin-top: 80px;
      height: 100%;
      .goods-list {
        .goods-sort-box {
          display: flex;
          justify-content: space-between;
          align-items: center;
          padding: 20px 0;
          .goods-nav {
            display: flex;
            align-items: center;
          }
          .goods-title {
            height: 36px;
            line-height: 36px;
            font-weight: 500;
            font-size: 28px;
            color: #333;
            font-weight: bold;
            border-left: 6px solid #ff4c4c;
            padding-left: 10px;
          }
          .nav-list {
            display: flex;
            align-items: center;
            margin-left: 200px;
            .nav-item {
              margin: 0 10px;
              cursor: pointer;
            }
          }
        }
        .goods-item {
          display: flex;
          .goods-left {
            display: flex;
            flex-direction: column;
            .goods-top-img:hover,
            .goods-bottom-img:hover {
              box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.12);
              transform: translate(0, -10px);
              transform: scale(1.08);
            }
            .goods-top-img:hover {
              transition: all 0.4s;
            }
            .goods-bottom-img {
              margin-top: 16px;
              transition: all 0.4s;
            }
          }
          .goods-right {
            margin-left: 20px;
            display: flex;
            flex-wrap: wrap;
            gap: 20px;
            padding-bottom: 100px;
          }
          .sort-goods-item:hover {
            box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.12);
            transform: translate(0, -10px);
            transform: scale(1.1);
          }
          .sort-goods-item {
            width: 226px;
            height: 280px;
            cursor: pointer;
            display: flex;
            flex-direction: column;
            align-items: center;
            background: #fff;
            padding: 20px 0;
            transition: all 0.4s;
            .sort-goods-img {
              width: 140px;
              height: 140px;
              img {
                display: block;
                max-width: 100%;
                max-height: 100%;
              }
            }
            .sort-goods-title {
              text-align: center;
              line-height: 20px;
              padding: 20px 12px;
              display: -webkit-box;
              -webkit-box-orient: vertical;
              -webkit-line-clamp: 2;
              overflow: hidden;
              text-overflow: ellipsis;
            }
            .sort-goods-price {
              color: #ff4c4c;
            }
          }
        }
      }
    }
    .left-wrap,
    .right-wrap {
      width: 200px;
      // position: absolute;
      // bottom: 0;
      // left: 0;
      // right: 0;
      box-shadow: 0px 2px 2px 0px rgba(0, 0, 0, 0.12);
    }
  }
  .footer-wrap {
    width: 100%;
    height: 80px;
    background: #eaeaea;
    position: fixed;
    bottom: 0;
    left: 0;
    .tip {
      line-height: 80px;
      text-align: center;
    }
  }
}
</style>
